﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TTIServer
{

	[Serializable]
	public class GlobalPenSetting
	{


		public int Id;

		public long EMRID;

		public int ButtonID;

		public string SettingType;

		public char KeyCode;

		public bool Alt;

		public bool Ctrl;

		public bool Shift;


	}

	[Serializable]
	public class StylusButtonID
	{


		public int ButtonID;

		public string Name;

	}

	[Serializable]
	public class PenType
	{

		public int Id;

		public string PenID;

		public string PenName;

		public bool PenTip;

		public bool FrontRocker;

		public bool RearRocker;

		public bool Eraser;

		public bool XTilt;

		public bool YTilt;

		public bool ZDistance;

		public bool Rotation;

		public bool Wheel;

		public PenType( int id, String pen_id, String penName, bool pentip, bool fr, bool rr, bool eraser, bool xT, bool yT, bool zD, bool rot, bool wheel)
		{

			Id = id;
			PenID = pen_id;
			PenName = penName;
			PenTip = pentip;
			FrontRocker = fr;
			RearRocker = rr;
			Eraser = eraser;
			XTilt = xT;
			YTilt = yT;
			ZDistance = zD;
			Rotation = rot;
			Wheel = wheel;

		}

	}

	[Serializable]
	public class EMRDevice
	{

		public long Id;

		public PenType PenTypeInformation;

		public ExpressKeySettings.ExpressKey[] StylusButtonSettings;

		public string SerialNum;

		public string NickName;

		public string GetDefaultEMRName(string PenID)
		{

			switch (PenID.Substring(3))
			{
				case "006":
					return "LensCursor";
				case "806":
					return "Mouse";
				case "802":
					switch (PenID.Substring(0, 3))
					{
						case "100":
						case "000":
						default:
							return "GripPen";
						case "120":
							return "InkPen";
						case "140":
							return "ClassicPen";
						case "160":
							return "GripPenPro";
						case "180":
							return "2242GripPen";
					}

				case "804":
					return "ArtPen";
				case "902":
					return "AirbrushPen";
				default:
					return "Unknown";


			}

		}


	}

	 static class AvailalePens
	{


		 static PenType[] AllAvailableKPens = new PenType[] {
												//PenTip	FrontRocker	RearRocker	Eraser	X_Tilt	Y_Tilt	Z_Distance	Rotation		Wheel
			new PenType(0, "100802", "Grip Pen",		true,	true,		true,		true,	true,	true,	true,		false,		false ),
			new PenType(1, "140802", "Classic Pen",		true,	true,		true,		true,	true,	true,	true,		false,		false ),
			new PenType(2, "100804", "Art Pen",		true,	true,		true,		true,	true,	true,	true,		true,		false ),
			new PenType(3, "000802", "Grip Pen I4",		true,	true,		true,		true,	true,	true,	true,		false,		false ),
			new PenType(4, "000804", "Art Pen I4",		true,	true,		true,		true,	true,	true,	true,		true,		false ),
			new PenType(5, "120802", "Inking Pen",		true,	true,		true,		true,	true,	true,	true,		false,		false ),
			new PenType(6, "160802", "Pro Pen (13HD)",	true,	true,		true,		true,	true,	true,	true,		false,		false ),
			new PenType(7, "180802", "DTH2242 Pen",		true,	true,		true,		true,	true,	true,	true,		false,		false ),
			new PenType(8, "100902", "Airbrush Pen",	true,	true,		true,		true,	true,	true,	true,		false,		true ),
			new PenType(9, "000902", "Airbrush Pen I4",	true,	true,		true,		true,	true,	true,	true,		false,		true ),
			new PenType(10, "000006", "Lens Cursor",	false,	false,		false,		false,	true,	true,	true,		false,		false ),
			new PenType(11, "000806", "Mouse",			false,	false,		false,		false,	true,	true,	true,		false,		false ),
	 };

		 public static List<PenType> AvailableKPens
		 {
			 get
			 {
				 return new List<PenType>(AllAvailableKPens);
			 }

		 }
		


	}

	[Serializable]
	public class PenSettings
	{

		public ExpressKeySettings.ExpressKey[] StylusButtons;  //need to have a new method for Stylus Buttons
		public EMRDevice CurrentPenType;
		

		public PenSettings()
		{

		}

		
		//public void WritePenSettings()
		//{



		//}

		//public void ReadPenSettings()
		//{



		//}

	}

	

}
